<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>成像模式算法</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../static/bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="../static/bower_components/Ionicons/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../static/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="../static/dist/css/skins/_all-skins.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  <!-- bootstrap datepicker -->
  <link rel="stylesheet" href="../static/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="../static/plugins/iCheck/all.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../static/bower_components/select2/dist/css/select2.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="../static/dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <header class="main-header">
    <!-- Logo -->
    <a href="#" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini">超</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg">超声波成像系统平台</span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>

      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!--导航栏信息，已经删除-->
        </ul>
      </div>
    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar user panel -->
      <!-- search form -->
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu" data-widget="tree">
        <li><a href="${pageContext.request.contextPath}/main/medicalRecords"><i class="fa fa-circle-o"></i>
          病人病历管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/medicalRecordsAnalysis"><i
                class="fa fa-circle-o"></i> 病人数据统计分析管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/imagingData"><i class="fa fa-circle-o"></i> 成像数据管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/projectManage"><i class="fa fa-circle-o"></i> 项目管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/commentManage"><i class="fa fa-circle-o"></i>
          评价体系管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/logManage"><i class="fa fa-circle-o"></i> 平台日志信息管理</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/consumableMaterial"><i class="fa fa-circle-o"></i>
          平台耗材管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/userManage"><i class="fa fa-circle-o"></i>
          平台用户及权限管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/platformPortal"><i class="fa fa-circle-o"></i>
          超声波成像系统平台门户</a></li>
        <li><a href="${pageContext.request.contextPath}/main/sendControl"><i class="fa fa-circle-o"></i> 多通道发射控制</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/receiveControl"><i class="fa fa-circle-o"></i>
          多通道接收控制</a></li>
        <li><a href="${pageContext.request.contextPath}/main/syncControl"><i class="fa fa-circle-o"></i> 外部同步控制</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/dataCollect"><i class="fa fa-circle-o"></i> 数据采集与重建</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/waveGenerate"><i class="fa fa-circle-o"></i> 任意波束形成</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/main/scriptManage"><i class="fa fa-circle-o"></i>
          超声探头脚本管理</a></li>
        <li><a href="${pageContext.request.contextPath}/main/createImgAlgorithm"><i class="fa fa-circle-o"></i>
          成像模式算法</a></li>
        <li><a href="${pageContext.request.contextPath}/main/resolveImgAlgorithm"><i class="fa fa-circle-o"></i>
          图像处理算法</a></li>
        <li><a href="${pageContext.request.contextPath}/main/patientManage"><i class="fa fa-circle-o"></i>
          病人信息管理</a></li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        成像模式算法
        <small>详细信息</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">成像模式算法</a></li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title"><b>图片上传</b></h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <input type="file" id="image"><br/>
              <div id="uploadImg"></div>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>
      <div class="row">
        <div class="col-xs-12">
          <div class="panel-group" id="accordionUsed">
            <div class="panel panel-default">
              <div class="panel-heading">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionUsed"
                     href="#collapseOneUsed">
                    平面波快速成像
                  </a>
                </h4>
              </div>
              <div id="collapseOneUsed" class="panel-collapse collapse">
                <div class="panel-body">
                  <div class="col-md-6">
                    <img src="#" class="img-responsive" id="pic0">
                  </div>
                  <div class="col-md-6">
                  </div>
                </div>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionUsed"
                     href="#collapseTwoUsed">
                    斑点追踪
                  </a>
                </h4>
              </div>
              <div id="collapseTwoUsed" class="panel-collapse collapse">
                <div class="panel-body">
                  <div class="col-md-6">
                    <img src="#" class="img-responsive" id="pic1">
                  </div>
                  <div class="col-md-6">

                  </div>
                </div>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionUsed"
                     href="#collapseThreeUsed">
                    弹性成像
                  </a>
                </h4>
              </div>
              <div id="collapseThreeUsed" class="panel-collapse collapse">
                <div class="panel-body">
                  <div class="col-md-6">
                    <img src="#" class="img-responsive" id="pic2">
                  </div>
                  <div class="col-md-6">

                  </div>
                </div>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionUsedUsed"
                     href="#collapseFourUsed">
                    多普勒成像
                  </a>
                </h4>
              </div>
              <div id="collapseFourUsed" class="panel-collapse collapse">
                <div class="panel-body">
                  <div class="panel-body">
                    <div class="col-md-6">
                      <img src="#"
                           class="img-responsive" id="pic3">
                    </div>
                    <div class="col-md-6">
                    </div>
                  </div>
                </div>
              </div>

            </div>
          </div>
        </div>
      </div>
      <hr/>

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2018 <a href="#">上海大学 </a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Create the tabs -->
    <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
      <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
      <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
      <!-- Home tab content -->
      <div class="tab-pane" id="control-sidebar-home-tab">
        <h3 class="control-sidebar-heading">Recent Activity</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-birthday-cake bg-red"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                <p>Will be 23 on April 24th</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-user bg-yellow"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>

                <p>New phone +1(800)555-1234</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-envelope-o bg-light-blue"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>

                <p>nora@example.com</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-file-code-o bg-green"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>

                <p>Execution time 5 seconds</p>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

        <h3 class="control-sidebar-heading">Tasks Progress</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Custom Template Design
                <span class="label label-danger pull-right">70%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Update Resume
                <span class="label label-success pull-right">95%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-success" style="width: 95%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Laravel Integration
                <span class="label label-warning pull-right">50%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-warning" style="width: 50%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Back End Framework
                <span class="label label-primary pull-right">68%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-primary" style="width: 68%"></div>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

      </div>
      <!-- /.tab-pane -->
      <!-- Stats tab content -->
      <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
      <!-- /.tab-pane -->
      <!-- Settings tab content -->
      <div class="tab-pane" id="control-sidebar-settings-tab">
        <form method="post">
          <h3 class="control-sidebar-heading">General Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Report panel usage
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Some information about this general settings option
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Allow mail redirect
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Other sets of options are available
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Expose author name in posts
              <input type="checkbox" class="pull-right" checked>
            </label>

            <p>
              Allow the user to show his name in blog posts
            </p>
          </div>
          <!-- /.form-group -->

          <h3 class="control-sidebar-heading">Chat Settings</h3>

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Show me as online
              <input type="checkbox" class="pull-right" checked>
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Turn off notifications
              <input type="checkbox" class="pull-right">
            </label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">
              Delete chat history
              <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
            </label>
          </div>
          <!-- /.form-group -->
        </form>
      </div>
      <!-- /.tab-pane -->
    </div>
  </aside>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script src="../static/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="../static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="../static/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../static/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../static/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../static/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="../static/dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../static/dist/js/demo.js"></script>
<!-- page script -->
<!-- Select2 -->
<script src="../static/bower_components/select2/dist/js/select2.full.min.js"></script>
<!-- InputMask -->
<script src="../static/plugins/input-mask/jquery.inputmask.js"></script>
<script src="../static/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="../static/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!-- date-range-picker -->
<script src="../static/bower_components/moment/min/moment.min.js"></script>
<script src="../static/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- bootstrap datepicker -->
<script src="../static/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
<!-- bootstrap color picker -->
<script src="../static/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="../static/plugins/timepicker/bootstrap-timepicker.min.js"></script>
<!-- iCheck 1.0.1 -->
<script src="../static/plugins/iCheck/icheck.min.js"></script>
<!-- ChartJS -->
<script src="../static/bower_components/chart.js/Chart.js"></script>

<!--echarts插件加载-->
<script src="../static/plugins/echarts/echarts.js"></script>


<script type="text/javascript">
    // Todo 上传图片

    //给file添加一个事件,当选择了文件后,执行下面uploadFile的方法
    $("#image").bind("change", function () {
        uploadFile($(this));
    });

    //通过onChange直接获取base64数据
    function uploadFile(file) {
        var reader = new FileReader();
        var allowImgFileSize = 2100000; //上传图片最大值(单位字节)（ 2 M = 2097152 B ）超过2M上传失败
        var file = $("#image")[0].files[0];
        var imgUrlBase64;
        if (file) {
            //将文件以Data URL形式读入页面
            imgUrlBase64 = reader.readAsDataURL(file);
            reader.onload = function (e) {
                var fileName = file.name;
                var fileType = fileName.split(".")[1];
                if (fileType !== "jpg" && fileType !== "jpeg") {
                    alert('上传失败，后缀必须为jpg或者jpeg');
                    return;
                }
                //var ImgFileSize = reader.result.substring(reader.result.indexOf(",") + 1).length;//截取base64码部分（可选可不选，需要与后台沟通）
                else if (allowImgFileSize !== 0 && allowImgFileSize < reader.result.length) {
                    alert('上传失败，请上传不大于2M的图片！');
                    return;
                } else {
                    //先后段传送base64的图片编码
                    $.post("${pageContext.request.contextPath}/main/createPic.do", {
                        imageStr: reader.result
                    }, function (result, status) {
                        if (status === "success") {
                            var json = JSON.parse(result);

                            //TODO 挖四个空把这四个图显示了
                            for (var i = 0; i < json.length; i++) {
                                console.log(json[i]);
                                var pic = document.getElementById('pic'+i);
                                pic.setAttribute("src", json[i]);
                            }
                        }
                        else {
                            alert("处理失败！！！")
                        }
                    })
                }
            }
        }
    }
</script>

</body>
</html>
